﻿using System;
using System.Collections.Generic;
using System.Web;

namespace FDeal
{
    public class DiaDiemDealBUS
    {
        private DiaDiemDealDAO _dDAO;

        public DiaDiemDealBUS()
        {
            _dDAO = new DiaDiemDealDAO();
        }

        public void Insert(DiaDiemDealDTO obj)
        {
            _dDAO.insert(obj);
        }

        public void Insert(string iddiadiem, string diachi, string tinh)
        {
            DiaDiemDealDTO obj = new DiaDiemDealDTO();

            obj.Diachi = diachi;
            obj.Iddiadiem = iddiadiem;
            obj.Tinh = tinh;

            this.Insert(obj);
        }

        public void Delete(string idDeal)
        {
            _dDAO.delete(idDeal);
        }

        public void Update(DiaDiemDealDTO obj)
        {
            _dDAO.update(obj);
        }

        public DiaDiemDealDTO[] GetDsDiaDiemDeal()
        {
            return _dDAO.getDsDiaDiemDeal();
        }

        public DiaDiemDealDTO GetDiaDiemDeal(string idDiaDiem)
        {
            DiaDiemDealDTO[] ds = this.GetDsDiaDiemDeal();

            for (int i = 0; i < ds.Length; i++)
            {
                if (ds[i].Iddiadiem.Equals(idDiaDiem))
                    return ds[i];
            }
            return null;
        }
    }
}


